package com.bcxj.servicemap.service;

import com.bcxj.internalcommon.dto.ResponseResult;
import com.bcxj.internalcommon.response.DirectionResponse;
import com.bcxj.servicemap.remote.MapDirectionClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * ClassName: DirectionService
 * Package: com.bcxj.servicemap.service
 * Description:
 *
 * @Author BCXJ
 * @Create 2024/10/5 15:34
 * @Version 1.0
 * @Since 1.0
 */
@Service
public class DirectionService {

    @Autowired
    private MapDirectionClient mapDirectionClient;

    /**
     * 获取距离和时间
     * @param depLongitude
     * @param depLatitude
     * @param destLongitude
     * @param destLatitude
     * @return
     */
    public ResponseResult driving(String depLongitude, String depLatitude, String destLongitude, String destLatitude) {

        // 调用远程服务获取距离与时长
        DirectionResponse direction = mapDirectionClient.direction(depLongitude, depLatitude, destLongitude, destLatitude);

        return ResponseResult.success(direction);
    }

}
